﻿using System;
using System.Collections.Generic;
using System.Text;
using reactiveBT.Utilities;

namespace reactiveBT.BT
{
    /// <summary>
    /// 暂时废弃的抽象节点
    /// block特性会在毕业之后加入
    /// </summary>
    public abstract class Block : Branch
    {
        //Block也应该把Terminate的信息向上传导,后续可以考虑加入装饰性节点阻断挂起信息  
        public override BTState Tick(int BTid)
        {
            switch (children[activeChild].Tick(BTid))
            {
                case BTState.Continue:
                    return BTState.Continue;
                case BTState.Abort:
                    return BTState.Abort;
                default:
                    activeChild++;
                    if (activeChild == children.Count)
                    {
                        activeChild = 0;
                        return BTState.Success;
                    }
                    return BTState.Continue;
            }
        }
    }
}
